<?php
	if( ! defined( 'XOOPS_ROOT_PATH' ) ) exit ;

	if( ! isset( $module ) || ! is_object( $module ) ) $module = $xoopsModule ;
	else if( ! is_object( $xoopsModule ) ) die( '$xoopsModule is not set' )  ;

	if( file_exists("../language/".$xoopsConfig['language']."/modinfo.php") ) {
		include_once("../language/".$xoopsConfig['language']."/modinfo.php");
	} else {
		include_once("../language/english/modinfo.php");
	}

	include( './menu.php' ) ;

//	array_push( $adminmenu , array( 'title' => _PREFERENCES , 'link' => '../system/admin.php?fct=preferences&op=showmod&mod=' . $module->getvar('mid') ) ) ;
	$menuitem_dirname = $module->getvar('dirname') ;
	//array_push( $adminmenu , array( 'title' => _PREFERENCES , 'link' => 'admin/admin.php?fct=preferences&op=showmod&mod=' . $module->getvar('mid') ) ) ;
include '../xoops_version.php';

function adminmenu($currentoption = 0, $breadcrumb = '')
{
global $modversion, $adminmenu, $xoopsDB, $xoopsConfig, $xoopsModule;
$myts =& MyTextSanitizer::getInstance();
	
	/* Nice buttons styles */
	echo "
    	<style type='text/css'>
    	#buttontop { float:left; width:100%; background: #e7e7e7; font-size:93%; line-height:normal; border-top: 1px solid black; border-left: 0px solid black; border-right: 0px solid black; margin: 0; }
    	#buttonbar { float:left; width:100%; background: #e7e7e7 url('" . XOOPS_URL . "/modules/".$modversion['dirname']."/images/bg.png') repeat-x left bottom; font-size:93%; line-height:normal; border-left: 0px solid black; border-right: 0px solid black; margin-bottom: 0px; }
    	#buttonbar ul { margin:0; margin-top: 15px; padding:10px 10px 0; list-style:none; }
		#buttonbar li { display:inline; margin:0; padding:0; }
		#buttonbar a { float:left; background:url('" . XOOPS_URL . "/modules/".$modversion['dirname']."/images/left_both.png') no-repeat left top; margin:0; padding:0 0 0 9px; border-bottom:1px solid #000; text-decoration:none; }
		#buttonbar a span { float:left; display:block; background:url('" . XOOPS_URL . "/modules/".$modversion['dirname']."/images/right_both.png') no-repeat right top; padding:5px 15px 4px 6px; font-weight:bold; color:#765; }
		/* Commented Backslash Hack hides rule from IE5-Mac \*/
		#buttonbar a span {float:none;}
		/* End IE5-Mac hack */
		#buttonbar a:hover span { color:#333; }
		#buttonbar #current a { background-position:0 -150px; border-width:0; }
		#buttonbar #current a span { background-position:100% -150px; padding-bottom:5px; color:#333; }
		#buttonbar a:hover { background-position:0% -150px; }
		#buttonbar a:hover span { background-position:100% -150px; }
		</style>";

	$tblColors = array();
	$tblColors = array_pad ($tblColors, count($adminmenu), ""); 
	
	if($currentoption>=0) {
		$tblColors[$currentoption] = 'current';
	}
	echo "<div id='buttontop' style='border-right: 1px solid black;border-left: 1px solid black;margin-bottom:8px;padding-bottom:0;'>"; 
	echo "<table style='width: 100%; padding:0;' cellspacing='0'><tr>";
	echo "<td style=\"width: 60%; font-size: 10px; text-align: left; color: #2F5376; padding: 0 6px; line-height: 18px;\">"; if(isset($modversion['config'])){echo"<a class=\"nobutton\" href=\"../../system/admin.php?fct=preferences&amp;op=showmod&amp;mod=".$xoopsModule->getVar('mid')."\">Preferences</a> | ";} echo"<a href=\"../index.php\">Go to module</a>"; if(isset($modversion['hasHelp']) && $modversion['hasHelp']==1){echo"| <a href=\"".$modversion['helpUrl']."\">Help</a>";} echo "</td>";
	echo "<td style=\"width: 40%; font-size: 10px; text-align: right; color: #2F5376; padding: 0 6px; line-height: 18px;\"><b>" . $xoopsModule->name() . "  </b> " . $breadcrumb . "</td>";
	echo "</tr></table>";
	echo "<div id='buttonbar'>";
	echo "<ul>";
	for($i=0; $i<count($adminmenu); ++$i){ //XOOPS_ROOT_PATH."/modules/".$modversion['dirname']."/admin/
		echo "<li id='" . $tblColors[$i] . "'><a href='".XOOPS_URL."/modules/".$modversion['dirname']."/".$adminmenu[$i]['link']."'><span>" . $adminmenu[$i]['title'] . "</span></a></li>\n";
	}
	echo "</ul></div>";
	echo "</div><div style='margin-bottom:2px;'>&nbsp;</div>";
	
}

if(!isset($_GET['currentID'])){
	$_GET['currentID'] =0;
}

adminmenu($_GET['currentID']);//creates tabs in admin section





/* 	echo "<div width='95%' align='center'>\n" ;
	$menuitem_count = 0 ;
	$mymenu_uri = empty( $mymenu_fake_uri ) ? $_SERVER['REQUEST_URI'] : $mymenu_fake_uri ;
	foreach( $adminmenu as $menuitem ) {
		if( stristr( $mymenu_uri , $menuitem['link'] ) ) {
			$menuitem_bgcolor = '#FFCCCC' ;
		} else {
			$menuitem_bgcolor = '#DDDDDD' ;
		}
		echo "<a href='".XOOPS_URL."/modules/$menuitem_dirname/{$menuitem['link']}' style='background-color:$menuitem_bgcolor;font:normal normal bold 9pt/12pt;'>{$menuitem['title']}</a> &nbsp; \n" ;

		if( ++ $menuitem_count >= 4 ) {
			echo "</div>\n<div width='95%' align='center'>\n" ;
			$menuitem_count = 0 ;
		}
	}
	echo "</div>\n" ; */
?>